<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
    String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="copyright" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<title>客户行为</title>
<link href="../favicon.ico" rel="shortcut icon"/>
<link rel="stylesheet" type="text/css" href="<%=path%>/timePluls/bootstrap-datetimepicker-master/sample in bootstrap v3/bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="<%=path%>/css/public.css" />
<link rel="stylesheet" type="text/css" href="<%=path%>/css/custom.css" />
<link rel="stylesheet" type="text/css" href="<%=path%>/timePluls/bootstrap-datetimepicker-master/css/bootstrap-datetimepicker.min.css">

<!--提示框 -->
<%--     <link rel="stylesheet" type="text/css" href="<%=path%>/bc/css/alert.css" />  --%>
<!--  -->

<!-- 时间控件 -->
<script type="text/javascript" src="<%=path%>/timePluls/jquery-1.11.3.min.js"></script>


<!-- 文件上传 -->
<%-- <script type="text/javascript" src="<%=path%>/timePluls/jquery-form.js"></script> --%>
<link href="<%=path%>/jQueryFiler/css/jquery.filer.css" type="text/css" rel="stylesheet" />
<link href="<%=path%>/jQueryFiler/css/themes/jquery.filer-dragdropbox-theme.css" type="text/css" rel="stylesheet" />

<script src="<%=path%>/jQueryFiler/js/jquery.filer.min.js"></script>
<!--  -->

<script type="text/javascript" src="<%=path%>/timePluls/bootstrap-datetimepicker-master/sample in bootstrap v3/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<%=path%>/timePluls/bootstrap-datetimepicker-master/js/locales/bootstrap-datetimepicker.fr.js"></script>
<script type="text/javascript" src="<%=path%>/timePluls/bootstrap-datetimepicker-master/js/moment-with-locales.js"  ></script>
<script type="text/javascript" src="<%=path%>/timePluls/bootstrap-datetimepicker-master/js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" src="<%=path%>/timePluls/bootstrap-datetimepicker-master/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>

<!--  -->

<title>Insert title here</title>
<style type="text/css">#droppable > .m_xline> .right ::-webkit-input-placeholder{color:red;}
    
  .datatime{}</style>
</head>
<body>

  <!-- 删除客户弹框 -->
    <div class="s_popup_box s_popup_delect" style="    position: fixed;top: 0;left: 0;right: 0;
    bottom: 0;background: rgba(0,0,0,.3);display: none;z-index: 999999;" >
        <div class="s_popup_detailed issue_delect" style="    background: #fff; position: fixed;left: 35%; top: 20%;
    width: 520px;border-radius: 3px;text-align: center;border-top: 4px solid #03a9f4;padding: 30px 2%;" >
            <span style="    position: absolute;right: 30px;top: 30px;cursor: pointer;"><img src="<%=path%>/sys/set/images/close.png" id = "i_cancel_del" /></span>
            <h4 style="    font-size: 20px;margin-bottom: 10px;color: #333;background: #fff;"><img src="<%=path%>/sys/set/images/warning.png" />删除客户</h4>
            <h5 style="    text-align: center;color: #999;font-size: 16px;height: 30px;line-height: 30px;">确定要删除此客户吗？</h5>
            <div style="display: none;" id = "save_del_id"></div>
            <p style="text-align: center;margin-top: 30px;"><a href="javascript:;" style="    background: #03a9f4;width: 100px;height: 40px;line-height: 40px;
    font-size: 14px;display: inline-block;border-radius: 3px;" class="s_cancel_del">取消</a>
     <a href="javascript:;" style="background: #03a9f4;width: 100px;height: 40px;line-height: 40px;font-size: 14px;
    display: inline-block;border-radius: 3px;" class="s_confirm_del" onclick="s_confirm_del()">确定</a></p>
        </div>
    </div>

     <div class="s_content_customer m_xwraps" style="min-height:1800px;">
			<div style=" height: 30px; width: 100%; float:right; padding-right: 10px;" align="right" id="charShowOrhide">
				<a href="javascript:;" style="font-size: 16px; color: #03a9f4;" onclick="hideChar()">隐藏</a>
			</div>
		<div class="m_xscale" style="margin-top:30px">
			<ul class="c_warpbox">
				<li id="c_warp1" class="c_warp"></li>
				<li id="c_warp2" class="c_warp"></li>
				<li id="c_warp3" class="c_warp"></li>
				<li id="c_warp4" class="c_warp"></li>
				<li id="c_warp5" class="c_warp"></li>
			</ul>
		</div>
		<div class="m_xnavs fix">
			<shiro:hasPermission name="customer_info_import_button">
				<a href="javascript:;" class="news ru"><img src="<%=path%>/images/add_2.png" />导入</a>
		    </shiro:hasPermission>
		    <shiro:hasPermission name="customer_info_create_button">
			<a href="javascript:;" class="news J_xnews"><img src="<%=path%>/images/add_1.png" />新建</a></shiro:hasPermission>
				<input type="hidden" value=""  id="customerID" name="customerID">
			<div class="line">
				<span>关键字</span>
				<p>
					<input type="text" placeholder="输入姓名/邮箱/电话，支持模糊搜索" class="text"
						id="nameOrphone" maxlength="15" onblur="checkLength(this)">
				</p>
			</div>
			<div class="line" style="width: 210px;">
				<span>参与活动</span>
				<div class="k_select">
					<span id="selectActivity">全部</span>
					<div class="k_selectBox">
						<ul id="activity">
							<li onclick="selectActivity(0)">全部</li>
							<li onclick="selectActivity(1)">已参加</li>
							<li onclick="selectActivity(2)">未参加</li>
						</ul>
					</div>
					<span class="k_dropImg" style="top:15px;">
					<img src="<%=path%>/images/dropDown.png" /></span>
				</div>
			</div>
			<div class="line" style="width: 180px;">
				<span>来源</span>
				<div class="k_select">
					<span id="allsource">全部</span>
					<div class="k_selectBox">
						<ul id="source">
						</ul>
					</div>
					<span class="k_dropImg" style="top:15px;"><img
						src="<%=path%>/images/dropDown.png" /></span>
				</div>
			</div>
			<div class="line">
			<shiro:hasPermission name="customer_info_search_button">
				<a href="javascript:;" class="search" onclick="searchCustmerList()">
				<img src="<%=path%>/images/search.png" /></a>
				</shiro:hasPermission>
			</div>
		</div>
		<div class="m_xallot">
		<shiro:hasPermission name="customer_info_dimension_button">
			<a href="javascript:;" class="made J_xmade">客户维度属性定制</a>
			</shiro:hasPermission>
			<div class="nature blue" id="customerList">全部</div>
			<div class="nature" id="totalDay" style="cursor:pointer">
				时间属性 <i> <img src="<%=path%>/images/top_1.png" id="totalDayTop" />
					<img src="<%=path%>/images/top_2.png" id="totalDayDown" />
				</i>
			</div>
			<div class="nature" id="totalConsumption" style="cursor:pointer">
				频率<i><img src="<%=path%>/images/top_1.png" id="totalConsumptionTop" />
				<img src="<%=path%>/images/top_2.png" id="totalConsumptionDown" /></i>
			</div>
			<div class="nature" id="tradingVolume" style="cursor:pointer">
				交易量<i><img src="<%=path%>/images/top_1.png"
					id="tradingVolumeTop" /> <img src="<%=path%>/images/top_2.png"
					id="tradingVolumeDown" /> </i>
			</div>
			<div class="nature" id="lossCustromer">流失客户</div>
		</div>
		<div class="m_xdatuma">
			<div class="m_xmeans">
				
			</div>
			<div class="m_xconent"></div>
		</div>
	</div>

        <!-- 提示框 -->
<!--         <div class="s_popup_delectwen"> -->
<!--         <div class="s_consumwen"> -->
<!--             <p id="dialog_title"><img src="../bm/images/s_tick.png" > </p > -->
<!--         </div> -->
<!--         </div> -->
        <!--  -->


	<div class="m_xpopups">
		<div class="m_xconsum show" style="margin-top: -500px;">
			<div class="wire"></div>
			<div class="title">
				<i class="J_xclose"><img src="<%=path%>/images/close.png" /></i><span>新建客户</span>
			</div>
			<div class="m_xline" id="nameadd">
				<span>姓名</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入姓名" id="namea"
						name="name" />
				</div>
			</div>
			<div class="m_xline" id="phoneadd">
				<span>手机号</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入手机号" id="phonea"
						name="phone" />
				</div>
			</div>
			<div class="m_xline" id="emailadd">
				<span>邮箱</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入邮箱" id="emaila"
						name="email" />
				</div>
			</div>
			<div class="m_xline" id="companyadd">
				<span>公司</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入公司名称" id="companya"
						name="company" />
				</div>
			</div>
			<div class="m_xline" id="jobadd">
				<span>职位</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入职位" id="joba"
						name="joba" />
				</div>
			</div>
			<div class="m_xline" id="remarksadd">
				<span>备注</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入备注" id="remarksa"
						name="remarks" />
				</div>
			</div>
			<div class="m_xline" id="genderadd">
				<span>性别</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入性别" id="gendera"
						name="remarks" />
				</div>
			</div>
			<div class="m_xline" id="birthdayadd">
				<span>生日</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入生日" id="birthdaya"
						name="birthdaya" />
				</div>
			</div>
			<div class="m_xline" id="weiboadd">
				<span>微博</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入微博" id="weiboa"
						name="weiboa" />
				</div>
			</div>
			<div class="m_xline" id="qqadd">
				<span>QQ</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入QQ" id="qqa"
						name="qqa" />
				</div>
			</div>
			<div class="m_xline" id="wechatadd">
				<span>微信</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入微信" id="wechata"
						name="wechata" />
				</div>
			</div>
			<div class="m_xline" id="addressadd">
				<span>地址</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入地址" id="addressa"
						name="addressa" />
				</div>
			</div>
			<div class="m_xline" id="cityadd">
				<span>城市</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入城市" id="citya"
						name="citya" />
				</div>
			</div>
			<div class="m_xline" id="faxadd">
				<span>传真</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入传真" id="faxa"
						name="faxa" />
				</div>
			</div>
			<div class="m_xline" id="tagadd">
				<span>标签</span>
				<div class="right">
					<input type="text" class="text" placeholder="请输入标签" id="taga"
						name="taga" />
				</div>
			</div>
			
			<div id = "fix_html">
			 
			
<!-- 			                        时间控件 -->
<!--                                     <div style="width: 330px;heigth:48px;"> <div class="form-group"> <div class="input-group date" id="datetimepicker11"> -->
<!--                                       <input  name="birthday" type="text" class="form-control" />  -->
<!--                                     <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span></div></div></div>   -->
                          <div class="m_xline" style="display: none;">
			              <span class="datatime"></span>
						  </div>
                                    
			</div>
			<div class="m_xline">
				<span></span>
				<div class="right">
					<a href="javascript:;" class="btns" onclick="saveOrUpdate()">保 存</a>
				</div>
			</div>
			<div class="m_xline">
				<span></span>
				<div class="right">
					<a href="javascript:;" class="reset J_xreset">重新设计信息项</a>
				</div>
			</div>
		</div>
		<div class="m_xsubunit show">
			<div class="m_xinfos">
			<div class="title">信息组件</div>
				<p class="talk">蓝色只可拖动一次，黑色可拖动多次</p>
				<div class="m_xboxs">
					<p>1、拖动组件中的内容到右侧空白处，会自动成为联系人的信息项</p>
					<ul>
						<li>
						<span class="on">姓名</span>
							<div id="draggable" class="draggable only ">
								<div class="m_xline" id="name">
									<span>姓名</span>
									<div class="right">
										<p class="text" /></p>
									</div>
									<em>移除</em>
								</div>
							</div></li>
						<li><span class="on">性别</span>
							<div id="draggable1" class="draggable only">
								<div class="m_xline" id="gender">
									<span>性别</span>
									<div class="right">
										<p class="text" /></p>
									</div>
									<em>移除</em>
								</div>
							</div></li>
						<li><span class="on">生日</span>
							<div id="draggable2" class="draggable only">
								<div class="m_xline" id="birthday">
									<span>生日</span>
									<div class="right">
										<p class="text" /></p>
									</div>
									<em>移除</em>
								</div>
							</div></li>
						<li><span class="on">手机号</span>
							<div id="draggable3" class="draggable only">
								<div class="m_xline" id="phone">
									<span>手机号</span>
									<div class="right">
										<input type="text" class="text" />
									</div>
									<em>移除</em>
								</div>
							</div></li>
						<li><span class="on">新浪微博</span>
							<div id="draggable4" class="draggable only">
								<div class="m_xline" id="weibo">
									<span>新浪微博</span>
									<div class="right">
										<input type="text" class="text" />
									</div>
									<em>移除</em>
								</div>
							</div></li>
						<li><span class="on">QQ</span>
							<div id="draggable5" class="draggable only">
								<div class="m_xline" id="qq">
									<span>QQ</span>
									<div class="right">
										<input type="text" class="text" />
									</div>
									<em>移除</em>
								</div>
							</div></li>
						<li><span class="on">微信</span>
							<div id="draggable6" class="draggable only">
								<div class="m_xline" id="wechat">
									<span>微信</span>
									<div class="right">
										<input type="text" class="text" />
									</div>
									<em>移除</em>
								</div>
							</div></li>
						<li><span class="on">邮箱</span>
							<div id="draggable7" class="draggable only">
								<div class="m_xline" id="email">
									<span>邮箱</span>
									<div class="right">
										<input type="text" class="text" />
									</div>
									<em>移除</em>
								</div>
							</div></li>
						<li><span class="on">城市</span>
							<div id="draggable8" class="draggable only">
								<div class="m_xline" id="city">
									<span>城市</span>
									<div class="right">
										<input type="text" class="text" />
									</div>
									<em>移除</em>
								</div>
							</div></li>
						<li><span class="on">通讯地址</span>
							<div id="draggable9" class="draggable only">
								<div class="m_xline" id="address">
									<span>通讯地址</span>
									<div class="right">
										<input type="text" class="text" />
									</div>
									<em>移除</em>
								</div>
							</div></li>
						<li><span class="on">公司</span>
							<div id="draggable10" class="draggable only">
								<div class="m_xline" id="company">
									<span>公司</span>
									<div class="right">
										<input type="text" class="text" />
									</div>
									<em>移除</em>
								</div>
							</div></li>
						<li><span class="on">职位</span>
							<div id="draggable11" class="draggable only">
								<div class="m_xline" id="job">
									<span>职位</span>
									<div class="right">
										<input type="text" class="text" />
									</div>
									<em>移除</em>
								</div>
							</div></li>
						<li><span class="on">传真</span>
							<div id="draggable12" class="draggable only">
								<div class="m_xline" id="fax">
									<span>传真</span>
									<div class="right">
										<input type="text" class="text" />
									</div>
									<em>移除</em>
								</div>
							</div></li>
						<li><span class="on">标签</span>
							<div id="draggable13" class="draggable only">
								<div class="m_xline" id="tag">
									<span>标签</span>
									<div class="right">
										<input type="text" class="text" />
									</div>
									<em>移除</em>
								</div>
							</div></li>
												<li><span class="on" style="color: #666; border: 1px dashed #ddd;">备注</span>
													<div id="draggable14" class="draggable only">
														<div class="m_xline" id="remarks">
															<span>备注</span>
															<div class="right">
																<input type="text" class="text" />
															</div>
															<em>移除</em>
														</div>
													</div>
													</li>
					</ul>
				</div>
				<div class="m_xboxs always">
					<p>2、拖动组件中的内容到右侧空白处，会自动成为联系人的内容项</p>
					<ul class="now">
						<li><span>数字</span>
							<div id="draggable15" class="draggable">
								<div class="m_xline">
									<span style="margin-top: 5px;">数字 ></span>
									<div class="right">
									    <div id="数字"  style="display:none"></div>
									    <input id="name_数字"  type="text" class="text" placeholder="控件名(必填)" style="outline: none; border:solid 0px;width: 100px;float: left;color:red;" />
										<input type="number" class="text" disabled="disabled" style="width: 150px;float: right;"/>
									</div>
									<em onclick="removezidingyi(this)">移除</em>
								</div>
							</div></li>
						<li><span>单行文本</span>
							<div id="draggable16" class="draggable">
								<div class="m_xline">
									<span class="changeText" style="margin-top: 5px;">单行 ></span>
									<div class="right">
									    <div id="单行文本"  style="display:none"></div>
									    <input id="name_单行文本" type="text" class="text" placeholder="控件名(必填)" style="outline: none; border:solid 0px;width: 100px;float: left;color:red;" />
										<input type="text" class="text" disabled="disabled"   style="width: 150px;float: right;" />
									</div>
									<em onclick="removezidingyi(this)">移除</em>
								</div>
							</div></li>
						<li><span>多行文本</span>
							<div id="draggable17" class="draggable">
								<div class="m_xline">
									<span class="changeText" style="margin-top: 5px;">多行 ></span>
									<div class="right">
									    <div id="多行文本"  style="display:none"></div>
									    <input id="name_多行文本" type="text" class="text" placeholder="控件名(必填)" style="outline: none; border:solid 0px;width: 100px;float: left;color:red;" />
										<textarea   disabled="disabled" style="width: 150px;float: right;"></textarea>
									</div>
									<em onclick="removezidingyi(this)">移除</em>
								</div>
							</div></li>
						<li><span>单选</span>
							<div id="draggable18" class="draggable">
								<div class="m_xline">
									<span class="changeText" style="margin-top: 5px;">单选 ></span>
									<div class="right">
									    <div id="单选"  style="display:none"></div>
									    <input id="name_单选" type="text" class="text" placeholder="控件名(必填)" style="outline: none; border:solid 0px;width: 100px;float: left;color:red;" />
									    <select name="" class="m_xselect" style="width: 150px;float: right;">
											<option value="">是</option>
											<option value="">否</option>
										</select>
										<textarea  class="text" placeholder="控件值(必填,以逗号隔开)" style="outline: none; border:solid 0px;width:300px;color:red;" ></textarea>
<!-- 										<label -->
<!-- 											style="line-height: 40px; font-size: 14px; font-weight: normal; color: #bdbdbd; margin-right: 10px;"><input -->
<!-- 											type="radio" name="radio" -->
<!-- 											style="margin: 0; margin-right: 5px; vertical-align: 1px;" -->
<!-- 											checked /><span class="changeText">单选</span></label> <label -->
<!-- 											style="line-height: 40px; font-size: 14px; font-weight: normal; color: #bdbdbd; margin-right: 10px;"><input -->
<!-- 											type="radio" name="radio" -->
<!-- 											style="margin: 0; margin-right: 5px; vertical-align: 1px;" /><span -->
<!-- 											class="changeText">单选</span></label> -->
									</div>
									<em onclick="removezidingyi(this)">移除</em>
								</div>
							</div></li>
						<li><span>多选</span>
							<div id="draggable19" class="draggable">
								<div class="m_xline">
									<span style="margin-top: 5px;">多选 ></span>
									<div class="right">
									    <div id="多选"  style="display:none"></div>
									    <input id="name_多选" type="text" class="text" placeholder="控件名(必填)" style="outline: none; border:solid 0px;width: 100px;float: left;color:red;" />
									    <select name="" class="m_xselect" style="width: 150px;float: right;">
											<option value="">样例</option>
											<option value="">样例</option>
											<option value="">样例</option>
											<option value="">样例</option>
											<option value="">样例</option>
											<option value="">样例</option>
											<option value="">样例</option>
										</select>
										<textarea   class="text" placeholder="控件值(必填,以逗号隔开)" style="outline: none; border:solid 0px;width:300px;color:red;" ></textarea>
<!-- 										<label -->
<!-- 											style="line-height: 40px; font-size: 14px; color: #bdbdbd; font-weight: normal; margin-right: 10px;"><input -->
<!-- 											type="checkbox" style="margin: 0; margin-right: 5px;" />多选</label> <label -->
<!-- 											style="line-height: 40px; font-size: 14px; color: #bdbdbd; font-weight: normal; margin-right: 10px;"><input -->
<!-- 											type="checkbox" style="margin: 0; margin-right: 5px;" />多选</label> <label -->
<!-- 											style="line-height: 40px; font-size: 14px; color: #bdbdbd; font-weight: normal; margin-right: 10px;"><input -->
<!-- 											type="checkbox" style="margin: 0; margin-right: 5px;" />多选</label> <label -->
<!-- 											style="line-height: 40px; font-size: 14px; color: #bdbdbd; font-weight: normal; margin-right: 10px;"><input -->
<!-- 											type="checkbox" style="margin: 0; margin-right: 5px;" />多选</label> <label -->
<!-- 											style="line-height: 40px; font-size: 14px; color: #bdbdbd; font-weight: normal; margin-right: 10px;"><input -->
<!-- 											type="checkbox" style="margin: 0; margin-right: 5px;" />多选</label> -->
									</div>
									<em onclick="removezidingyi(this)">移除</em>
								</div>
							</div></li>
						<li><span>下拉列表</span>
							<div id="draggable20" class="draggable">
								<div class="m_xline">
									<span style="margin-top: 5px;" >下拉 ></span>
									<div class="right">
									    <div id="下拉列表"  style="display:none"></div>
									    <input id="name_下拉列表" type="text" class="text" placeholder="控件名(必填)" style="outline: none; border:solid 0px;width: 100px;float: left;color:red;" />
									    <select name="" class="m_xselect" style="width: 150px;float: right;">
											<option value="">样例</option>
											<option value="">样例</option>
											<option value="">样例</option>
											<option value="">样例</option>
											<option value="">样例</option>
										</select>
										<textarea   class="text" placeholder="控件值(必填,以逗号隔开)" style="outline: none; border:solid 0px;width:300px;color:red;" ></textarea>
									</div>
									<em onclick="removezidingyi(this)">移除</em>
								</div>
							</div></li>
							                 
						<li><span>日期</span>
							<div id="draggable21" class="draggable">
								<div class="m_xline">
									<span style="margin-top: 5px;">日期 ></span>
									<div class="right">
									 <div id="日期"  style="display:none"></div>
									   <input id="name_日期" type="text" class="text" placeholder="控件名(必填)" style="outline: none; border:solid 0px;width: 100px;float: left;color:red;" />
										<input type="text" class="text" style="width: 150px;float: right;"/>
						            </div>
									<em onclick="removezidingyi(this)">移除</em>
								</div>
							</div></li>
							
							
						<li><span>评分</span>
							<div id="draggable22" class="draggable">
								<div class="m_xline">
									<span style="margin-top: 5px;">评分 ></span>
									<div class="right">
									    <div id="评分"  style="display:none"></div>
									    <input id="name_评分" type="text" class="text" placeholder="控件名(必填)" style="outline: none; border:solid 0px;width: 100px;float: left;color:red;" />
										<div class="m_xstra lsg" style="width: 150px;float: right;">
											<img src="<%=path%>/images/star_2.png"
												onclick="pfClick(this)" style="width: 13px;"
												class="unSelect"> <img
												src="<%=path%>/images/star_2.png" onclick="pfClick(this)"
												style="width: 13px;" class="unSelect"> <img
												src="<%=path%>/images/star_2.png" onclick="pfClick(this)"
												style="width: 13px;" class="unSelect"> <img
												src="<%=path%>/images/star_2.png" onclick="pfClick(this)"
												style="width: 13px;" class="unSelect"> <img
												src="<%=path%>/images/star_2.png" onclick="pfClick(this)"
												style="width: 13px;" class="unSelect">
											<dfn class="pfText">0.0分</dfn>
											<input type="text" value="" style="display: none;" class="pf" />
										</div>
									</div>
									<em onclick="removezidingyi(this)">移除</em>
								</div>
							</div></li>
						<li><span>图片</span>
							<div id="draggable23" class="draggable">
								<div class="m_xline">
									<span style="margin-top: 5px;">图片 ></span>
									<div class="right">
									        <div id="图片"  style="display:none"></div>
									        <input id="name_图片" type="text" class="text" placeholder="图片控件名(必填)" style="outline: none; border:solid 0px;width: 100px;float: left;color:red;" />
<!-- 										<b>上传图片<input type="file"></b> -->
											<input type="file" style="width: 150px;float: right;">
									</div>
									<em onclick="removezidingyi(this)">移除</em>
								</div>
							</div></li>
						<li><span>分割线</span>
							<div id="draggable24" class="draggable">
								<div class="m_xline">
								 <div id="分割线"  style="display:none"></div>
									<span class="line"></span> <em onclick="removezidingyi(this)">移除</em>
								</div>
							</div></li>
						<li><span>附件</span>
							<div id="draggable25" class="draggable">
								<div class="m_xline">
									<span style="margin-top: 5px;">附件 ></span>
									<div class="right">
									        <div id="附件"  style="display:none"></div>
										    <input id="name_附件" type="text" class="text" placeholder="上传控件名(必填)" style="outline: none; border:solid 0px;width: 100px;float: left;color:red;" />
<!-- 										<b>上传<input type="file"></b> -->
											<input type="file" style="width: 150px;float: right;">
									</div>
									<em onclick="removezidingyi(this)">移除</em>
								</div>
							</div></li>
					</ul>
				</div>
			</div>
			<div class="m_xinfos z_long">
				<div class="title none">
					<i><img src="<%=path%>/images/close.png"  class="q_close"></i>定义客户资料组件
				</div>
				<p class="talk">从头开始创建客户资料组件</p>
				<div class="m_xforms" style="width: 440px;">
					<form class="ui-widget-header" id="droppable"></form>
				</div>
				<div class="m_xbutton">
					<a href="javascript:;" onclick="add()">生效表单</a> <a
						href="javascript:;" class="white  q_close">取消</a>
				</div>
			</div>
		</div>
	</div>
	<div class="m_xdimens">
		<div class="m_xconsum m_xtailor">
			<div class="wire"></div>
			<div class="title">
				<i class="J_xcancel"><img src="<%=path%>/images/close.png" /></i>客户维度属性定制
			</div>
			<div class="m_xtrade none">
				<div class="abs">交易时间</div>
				<div class="right">
					<div class="consume">
						<span>距第一次消费小于</span> <input type="text" value="" class="text"
							id="new_customer_day" name="new_customer_day"> <span>天，且次数小于</span>
						<input type="text" value="" class="text"
							id="new_customer_frequency" name="new_customer_frequency">
						<span>次，即为新客户</span> <i><img src="<%=path%>/images/host_6.png" /></i>
					</div>
					<div class="consume">
						<span>距第一次消费大于</span> <input type="text" value="" class="text"
							id="old_customer_day" name="old_customer_day"> <span>天，且次数大于</span>
						<input type="text" value="" class="text"
							id="old_customer_frequency" name="old_customer_frequency">
						<span>次，即为老客户</span> <i><img src="<%=path%>/images/host_3.png" /></i>
					</div>
				</div>
			</div>
			<div class="m_xtrade">
				<div class="abs">交易频率</div>
				<div class="right">
					<div class="consume">
						<input type="text" value="" class="text nolo" id="traveler_day"
							name="traveler_day"> <span>天，消费累计</span> <input
							type="text" value="" class="text" id="traveler_frequency"
							name="traveler_frequency"> <span>次，即为过客</span> <i><img
							src="<%=path%>/images/host_2.png" /></i>
					</div>
					<div class="consume">
						<input type="text" value="" class="text nolo" id="regular_day"
							name="regular_day"> <span>天，消费累计</span> <input
							type="text" value="" class="text" id="regular_frequency"
							name="regular_frequency"> <span>次，即为常客</span> <i><img
							src="<%=path%>/images/host_7.png" /></i>
					</div>
					<div class="consume">
						<input type="text" value="" class="text nolo"
							id="loyal_customer_day" name="loyal_customer_day"> <span>天，消费累计</span>
						<input type="text" value="" class="text"
							id="loyal_customer_frequency" name="loyal_customer_frequency">
						<span>次，即为忠诚客户</span> <i><img
							src="<%=path%>/images/host_5.png" /></i>
					</div>
				</div>
			</div>
			<div class="m_xtrade">
				<div class="abs">交易额度</div>
				<div class="right">
					<div class="consume">
						<span>消费累计小于</span> <input type="text" value="" class="text long"
							id="scattered_customer" name="scattered_customer"> <span>元，即为散客</span>
						<i><img src="<%=path%>/images/host_9.png" /></i>
					</div>
					<div class="consume">
						<span>消费累计大于</span> <input type="text" value="" class="text long"
							id="s_commonly_customer" name="s_commonly_customer"> <span>元，小于</span>
						<input type="text" value="" class="text long"
							id="b_commonly_customer" name="b_commonly_customer"> <span>元，即为普通客户</span>
						<i><img src="<%=path%>/images/host_8.png" /></i>
					</div>
					<div class="consume">
						<span>消费累计大于</span> <input type="text" value="" class="text long"
							id="main_force" name="main_force"> <span>元，即为主力客户</span>
						<i><img src="<%=path%>/images/host_1.png" /></i>
					</div>
				</div>
			</div>
			<div class="m_xtrade bott">
				<div class="abs">流失定义</div>
				<div class="right">
					<div class="consume">
						<span>距离最近消费大于</span> <input type="text" value="" class="text"
							id="lose_customer" name="lose_customer"> <span>天，即为流失客户</span>
						<i><img src="<%=path%>/images/host_4.png" /></i>
					</div>
				</div>
			</div>
			<div class="button">
				<a href="javascript:;" class="cancel J_xcancel">取消</a> <a
					href="javascript:;" class="ensure J_xcancel"
					onclick="saveUserDimension()">确定</a>
			</div>
		</div>
	</div>
	<div class="s_popups">
		<div class="m_xconsum show">
			<div class="wire"></div>
			<div class="title">
				<i class="J_sclose"><img src="<%=path%>/images/close.png" /></i>导入客户
			</div>
			<div class="s_box_con">
				<dl class="fix">
					<dt>1</dt>
					<dd>
						支持excel导入，请先下载模板<br /> <a href="<%=path%>/excel/customer.xls">客户资料模板</a>
					</dd>
				</dl>
				<dl class="fix">
					<dt>2</dt>
					<dd>
						<input type="hidden" type="button" id="uploadfile"
							onclick="import_excle_info()" /> <a href="javascript:;">上传导入excel文件<input
							type="file" class="file" name="file" id="file"
							accept="application/vnd.ms-excel"></a> <br /> <span>并严格按照模板格式整理客户资料否则无法导入客户资料</span>
					</dd>
				</dl>
				<div class="s_bottom">
					<i>选择重复数据处理方式（以电话唯一性判断重复数据）</i>
					<ul class="fix">
						<li><img id="fugai" src="<%=path%>/images/s_icon_on.png"
							onclick="imager('1')" />重复数据覆盖</li>
						<li><img id="tiaoguo" src="<%=path%>/images/s_icon.png"
							onclick="imager('2')" />重复数据跳过</li>
					</ul>
				</div>
				<div class="button">
					<a href="javascript:;" class="cancel J_sclose">取消</a> <a
						href="javascript:;" class="ensure s_ok" onclick="fileUpload()">确定</a>
				</div>
			</div>
		</div>
	</div>
	<div class="s_popup">
		<div class="m_xconsum show">
			<div class="wire"></div>
			<div class="title">
				<i class="J_sclose"><img src="<%=path%>/images/close.png" /></i><img
					src="<%=path%>/images/s_caution.png" class="s_caution" />导入客户信息提示
			</div>
			<div class="s_box_cons">
				<p>导入结果</p>
				<ol id="excelmes">
				</ol>
				<div class="button">
					<a href="javascript:;" class="cancel ru">上一步</a> <a
						href="javascript:;" class="ensure s_oks">确定</a>
				</div>
			</div>
		</div>
	</div>

	<div class="s_popup2">
		<div class="m_xconsum show" style="top: 60%;">
			<div class="wire"></div>
			<div class="title">
				<i class="J_close"><img src="<%=path%>/images/close.png" /></i><img
					src="<%=path%>/images/s_tick.png" class="s_caution" />导入客户信息完成
			</div>
			<div class="s_box_cons">
				<p>客户资料导入完成！</p>
				<div class="button">
					<a href="javascript:;" class="ensure J_close">确定</a>
				</div>
			</div>
		</div>
		
		
		                     
		
		
	</div>
<%-- 	<script type="text/javascript" src="<%=path%>/js/jquery.min.js"></script> --%>
	<script type="text/javascript" src="<%=path%>/js/customrList.js"></script>
	<script type="text/javascript" src="<%=path%>/js/echarts.common.min.js"></script>
	<script type="text/javascript" src="<%=path%>/js/custom.js"></script>
	<script type="text/javascript" src="<%=path%>/js/jquery-ui.js"></script>
	<script type="text/javascript" src="<%=path%>/js/drop.js"></script>
	<script type="text/javascript" src="<%=path%>/js/Sortable.js"></script>
	<script type="text/javascript" src="<%=path%>/js/app_copy.js"></script>
	<script type="text/javascript" src="<%=path%>/js/ajaxfileupload.js"></script>
	<script type="text/javascript" src="<%=path%>/bm/js/lengthlimit.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/js/ InputLimited.js"></script>
	
	<script>
	
	$('.s_cancel_del').click(function(){
		$('.s_popup_box').addClass("hide");
		$('.s_popup_detailed').addClass("hide");
		$('.s_popup_box').removeClass("show");
		$('.s_popup_detailed').removeClass("show");
	});
    $('#i_cancel_del').click(function(){
    	$('.s_popup_box').addClass("hide");
		$('.s_popup_detailed').addClass("hide");
		$('.s_popup_box').removeClass("show");
		$('.s_popup_detailed').removeClass("show");
	});
	
	/******************************************************************************  */
	//移除传递过来的控件
	function removezidingyi(e){
		$(e).parents('.m_xline').remove();
        var	type=$(e).parents('.m_xline').find('.right').find('div').attr("id");
       if (($("#name_"+type).attr("value"))!=null&&( $("#name_"+type).attr("value"))!="") {
    	   $("#name_"+type).attr("value","");
	   }
        if (($('.m_xboxs,.always>.now>.li>.m_xline>.right').find('div[id='+type+']').parents('.right').find('textarea').text())!=null&&($('.m_xboxs,.always>.now>.li>.m_xline>.right').find('div[id='+type+']').parents('.right').find('textarea').text())!="") {
        	 $('.m_xboxs,.always>.now>.li>.m_xline>.right').find('div[id='+type+']').parents('.right').find('textarea').text("");
		}
        
        
	}
	
	/* 时间控件全局变量 */
	var datadpid="";
	/* 上传控件全局变量 */
	var uploadpid="";
	/*  */
	
	//新建客户，编辑客户调用方法（打开窗口初始化控件结构）
	function  ShowArchitecture(){
		
		$("#nameadd").hide();
		$("#phoneadd").hide();
		$("#emailadd").hide();
		$("#companyadd").hide();
		$("#jobadd").hide();
		$("#remarksadd").hide();
		$("#genderadd").hide();
		$("#birthdayadd").hide();
		$("#weiboadd").hide();
		$("#qqadd").hide();
		$("#wechatadd").hide();
		$("#addressadd").hide();
		$("#cityadd").hide();
		$("#faxadd").hide();
		$("#tagadd").hide();
		
		 $.ajax({
       		  url: "<%=path%>/api/ComponentStructure/Show_ComponentStructure",

       		  type: "post",
       		  
       		  async: false,

       		  data:{},

       		  dataType: "json",

       		  timeout: 1000,

       		  error: function(){},

       		  success: function(data){
       			
                if (data.status == 200) {
                	var showhtml ="";
                	console.log(data.list);
                	var returndata = data.list;
                	for (var int = 0; int < returndata.length; int++) {
                		console.log(returndata[int].textNameType);
						var type = returndata[int].textNameType;
						var name = returndata[int].textNameKey;
						
					  if (type!=null&&type!=""&&name!=null&&name!="") {
						
					    if (type=="FristType") {
					    	$('#' + name + 'add').show();
						}
					    if (type=="数字") {
					    	//拼装显示控件
							showhtml +='<div class="m_xline">'+
							'<span class="datatime">'+name+'</span>'+
							'<div class="right">'+
							'<div id="TypeId'+name+'" style="display:none">数字</div>'+
							'<div id="'+name+'" style="display:none">'+name+'</div>'+
							'<input type="number" class="text"  id = "fix_'+name+'" name="fix_'+name+'" />'+
							'</div>'+
							'</div>';
						}
					    if (type=="单行文本") {
					    	showhtml +='<div class="m_xline">'+
								'<span class="datatime">'+name+'</span>'+
								'<div class="right">'+
								'<div id="TypeId'+name+'" style="display:none">单行文本</div>'+
								'<div id="'+name+'" style="display:none">'+name+'</div>'+
								'<input type="text" class="text" placeholder="请输入'+name+'" id = "fix_'+name+'" name="fix_'+name+'" />'+
								'</div>'+
								'</div>';
						}
					    if (type=="多行文本") {
					    	showhtml +='<div class="m_xline">'+
								'<span class="datatime">'+name+'</span>'+
								'<div class="right">'+
								'<div id="TypeId'+name+'" style="display:none">多行文本</div>'+
								'<div id="'+name+'" style="display:none">'+name+'</div>'+
								'<textarea type="text" class="text" placeholder="请输入'+name+'" id = "fix_'+name+'" name="fix_'+name+'" ></textarea>'+
								'</div>'+
								'</div>';
							
						}
						 if (type=="单选") {
							var showselect = "";
							var  final_val =returndata[int].textNameVals.split(",");
								if (final_val.length>0) {
									for (var n = 0; n < final_val.length; n++) {
										showselect+='<option value="'+final_val[n].trim()+'">'+final_val[n].trim()+'</option>';
									}
								}
							 
							 showhtml +='<div class="m_xline">'+
								'<span class="datatime">'+name+'</span>'+
								'<div class="right">'+
								'<div id="TypeId'+name+'" style="display:none">单选</div>'+
								'<div id="'+name+'" style="display:none">'+name+'</div>'+
								'<select style="height:48px;width:330px;font-size:14px;" id = "fix_'+name+'" name="fix_'+name+'" class="m_xselect " > '+showselect+'</select>'+
								'</div>'+
								'</div>';				
							}
						 if (type=="多选") {
							 
							    var showselect = "";
							    var  final_val1 =returndata[int].textNameVals.split(",");
							if (final_val1.length>0) {
								for (var n = 0; n < final_val1.length; n++) {
									showselect+='<option value="'+final_val1[n].trim()+'">'+final_val1[n].trim()+'</option>';
								}
							}
							 
							 showhtml +='<div class="m_xline">'+
								'<span class="datatime">'+name+'</span>'+
								'<div class="right">'+
								'<div id="TypeId'+name+'" style="display:none">多选</div>'+
								'<div id="'+name+'" style="display:none">'+name+'</div>'+
								'<select style="height:48px;width:330px;font-size:14px;"  multiple="multiple"  id = "fix_'+name+'" name="fix_'+name+'" class="m_xselect" >'+
								showselect+
								'</select>'+
								'</div>'+
								'</div>';
							}
						 if (type=="下拉列表") {
							 
							  var showselect = "";
							  var  final_val1 =returndata[int].textNameVals.split(",");
							if (final_val1.length>0) {
								for (var n = 0; n < final_val1.length; n++) {
									showselect+='<option value="'+final_val1[n].trim()+'">'+final_val1[n].trim()+'</option>';
								}
							}
							 
							showhtml +='<div class="m_xline">'+
								'<span class="datatime">'+name+'</span>'+
								'<div class="right">'+
								'<div id="TypeId'+name+'" style="display:none">下拉列表</div>'+
								'<div id="'+name+'" style="display:none">'+name+'</div>'+
								'<select style="height:48px;width:330px;font-size:14px;"  id = "fix_'+name+'" name="fix_'+name+'" class="m_xselect" >'+
								showselect+
								'</select>'+
								'</div>'+
								'</div>';
							}
						 if (type=="日期") {
							 
							 
							 showhtml +='<div >'+
								'<span class="datatime" style="width: 20%;margin-top: 8px;float: left;text-align: right;margin-left: -19px;font-size:14px;">'+name+'</span>'+
								'<div class="right">'+
								'<div id="TypeId'+name+'" style="display:none">日期</div>'+
								'<div id="'+name+'" style="display:none">'+name+'</div>'+
								    '<div style="width: 330px;heigth:48px;margin-left:90px;">'+
								         '<div class="form-group"> '+
								               '<div class="input-group date" id="Time2_'+name+'">'+
                                                '<input  id = "fix_'+name+'" name="fix_'+name+'" type="text" class="form-control" /> '+
                                                '<span class="input-group-addon">'+
                                                       '<span class="glyphicon glyphicon-calendar">'+
                                                       '</span>'+
                                                '</span></div></div></div> '+
                             '</div>'+
								'</div>';
								
							 datadpid +="#Time2_"+name+",";
								
							}
						 if (type=="评分") {
							 
							 
							 
							 showhtml +='<div class="m_xline">'+
								'<span class="datatime">'+name+'</span>'+
								'<div class="right">'+
								'<div id="TypeId'+name+'" style="display:none">评分</div>'+
								'<div id="'+name+'" style="display:none">'+name+'</div>'+
//								
								'<div class="m_xstra lsg" style="width: 150px;">'+
								'<img src="<%=path%>/images/star_2.png" '+
									'onclick="pfClick(this)" style="width: 13px;" '+
									'class="unSelect"> <img '+
									'src="<%=path%>/images/star_2.png" onclick="pfClick(this)" '+
									'style="width: 13px;" class="unSelect"> <img  '+
									'src="<%=path%>/images/star_2.png" onclick="pfClick(this)" '+
									'style="width: 13px;" class="unSelect"> <img '+
									'src="<%=path%>/images/star_2.png" onclick="pfClick(this)"  '+
									'style="width: 13px;" class="unSelect"> <img '+
									'src="<%=path%>/images/star_2.png" onclick="pfClick(this)"  '+
									'style="width: 13px;" class="unSelect">  '+
								'<dfn class="pfText">0.0分</dfn>  '+
								'<input type="text" id = "fix_'+name+'" name="fix_'+name+'" style="display: none;" class="pf" /> '+
						     	'</div>  '+
								
								'</div>'+
								'</div>';
							}
						 
						 if (type=="图片") {
							 showhtml +='<div class="m_xline">'+
								'<span class="datatime">'+name+'</span>'+
								'<div class="right">'+
								'<div id="TypeId'+name+'" style="display:none">图片</div>'+
								'<div id="'+name+'" style="display:none">'+name+'</div>'+
								'<form id="file_'+name+'" enctype="multipart/form-data" >'+
								
								'<div style="height: 100px;width: 100px;">'+
								'<div style="width:100px;height:100px; position:relative;float:left;margin-left:4px;">'+
								'<img id="img4'+name+'" src="<%=path%>/bm/images/img_p.png" style="width:100px;height:100px;" >'+
								'</div>'+
								'<input type="file" accept="image/gif,image/jpeg,image/x-png" id = "fix_'+name+'" name="fix_'+name+'" onchange="showphoto(\''+name+'\')" '+
								' style="cursor:pointer;height:100px;width: 100px;filter: alpha(opacity = 50); -moz-opacity: 0.5; -khtml-opacity: 0.5; opacity: 0.0;'+
								 'position: absolute; z-index: 99;">'+
								'</div>'+
								
								'</form>'+
								'</div>'+
								'</div>';
							
							}
						 if (type=="分割线") {
							 showhtml +='<div class="m_xline">'+
								'<span class="datatime">'+name+'</span>'+
								'<div class="right">'+
								'<div id="TypeId'+name+'" style="display:none">分割线</div>'+
								'<div id="'+name+'" style="display:none">'+name+'</div>'+
								'<span style="display: inline-block;width: 342px;height: 20px;border-bottom: 1px dashed #ddd;margin-left: 18px;"></span>'+
								'</div>'+
								'</div>';
							}
						 if (type=="附件") {
								
							 
							 showhtml +='<div class="m_xline">'+
								'<span class="datatime">'+name+'</span>'+
								'<div class="right">'+
								'<div id="TypeId'+name+'" style="display:none">附件</div>'+
								'<div id="'+name+'" style="display:none">'+name+'</div>'+
								'<form id="realfile_'+name+'" enctype="multipart/form-data" >'+
								
//								'<input type="file" id = "fix_'+arrayob[1].trim()+'" name="fix_'+arrayob[1].trim()+'" />'+
								'<div id="fileremove'+name+'" name="have">'+
								'<input type="file" name="fix_'+name+'" id = "fix_'+name+'" >'+
								'</div>'+
								'</form>'+
								'</div>'+
								'</div>';
								
							 uploadpid +="#fix_"+name+",";	
							}
						}
                	}
                	//拼接所有文本
   				 $('.m_xpopups>.m_xconsum>#fix_html').html(showhtml);
                
                }
       		  }
       		  
       		  }); 
		
	}
	
	$(function(){
		
		//取消清空自定义控件div
		$('.q_close').click(function(){
			//$('#droppable>div').remove();
			$('#droppable>div').each(function(e,data){
				
				if (($(data).attr("id"))!=null&&($(data).attr("id"))!="") {
					 var val = 	$(data).attr("id");
					 //console.log("取消时还原状态"+val);
					 val = "#"+val;
					 reflashstatus(val);
				}
			
			});
			
			$('.m_xsubunit').removeClass('show'); 
			$('.m_xpopups').removeClass('show');  
		});
		
		
		$('.J_xreset').click(function(){
			var $this = $(this);
			
// 			$('#droppable>div').remove();
			
			/*
			 * ZHIWEN  
			 * @description 移动存在数据进打开的页面
			 */
			 //遍历判断自定义控件中是否已经有了该名字控件
			 var have_id = "";
			   $('#droppable > div').each(function(m, data2) {
				have_id += $(data2).attr('id')+",";
			  });
				/*
				 * ZHIWEN  
				 * @description 移动存在数据进打开的页面
				 */
				var html = "";
				
				$('.m_xpopups>.m_xconsum>.m_xline').each(function(i,data){
					
				if (($(data).css("display"))!="none") {
					
				 var id =	$(data).find('.right').find('input').attr("id");
				 //var val = $(data).find('.right').find('input').val();
						
							if ((have_id.indexOf(id))>0) {
								console.log("控件已存在");
							} else {
			
	
									if (id=="namea") {
										
										$('#draggable').addClass('ui-draggable-disabled');
										$('#draggable').parent('li').find('span').removeClass('on');
										$('#draggable').parent('li').find('span').addClass('gary');
										$('#draggable').draggable("disable");
										html +='<div class="m_xline" id="name">'+
										'<span>姓名</span> '+
										'<div class="right"> '+
											'<p class="text" /></p> '+
										'</div> '+
										'<em onclick="last_remove(\''+"name"+'\')" >移除</em> '+
									    '</div> ';
										
									}
							        if (id=="phonea") {
							        	$('#draggable3').addClass('ui-draggable-disabled');
										$('#draggable3').parent('li').find('span').removeClass('on');
										$('#draggable3').parent('li').find('span').addClass('gary');
										$('#draggable3').draggable("disable");
							        	html +='<div class="m_xline" id="phone"> '+
										'<span>手机号</span> '+
										'<div class="right">'+
											'<input type="text" class="text" />'+
										'</div>'+
										'<em onclick="last_remove(\''+"phone"+'\')" >移除</em>'+
									   '</div>	';
									}
							        if (id=="emaila") {
							        	$('#draggable7').addClass('ui-draggable-disabled');
										$('#draggable7').parent('li').find('span').removeClass('on');
										$('#draggable7').parent('li').find('span').addClass('gary');
										$('#draggable7').draggable("disable");
							        	html +='<div class="m_xline" id="email">'+
										'<span>邮箱</span>'+
										'<div class="right">'+
											'<input type="text" class="text" />'+
										'</div>'+
										'<em onclick="last_remove(\''+"email"+'\')" >移除</em>'+
									     '</div>';
									}
							        if (id=="companya") {
							        	$('#draggable10').addClass('ui-draggable-disabled');
										$('#draggable10').parent('li').find('span').removeClass('on');
										$('#draggable10').parent('li').find('span').addClass('gary');
										$('#draggable10').draggable("disable");
							        	html +='<div class="m_xline" id="company">'+
										'<span>公司</span>'+
										'<div class="right">'+
											'<input type="text" class="text" />'+
										'</div>'+
										'<em onclick="last_remove(\''+"company"+'\')" >移除</em>'+
									   '</div>';
									}
							        if (id=="joba") {
							        	$('#draggable11').addClass('ui-draggable-disabled');
										$('#draggable11').parent('li').find('span').removeClass('on');
										$('#draggable11').parent('li').find('span').addClass('gary');
										$('#draggable11').draggable("disable");
							        	html +='<div class="m_xline" id="job">'+
										'<span>职位</span>'+
										'<div class="right">'+
											'<input type="text" class="text" />'+
										'</div>'+
										'<em onclick="last_remove(\''+"job"+'\')" >移除</em>'+
									    '</div>';
									}
							        if (id=="remarksa") {
							        	$('#draggable14').addClass('ui-draggable-disabled');
										$('#draggable14').parent('li').find('span').removeClass('on');
										$('#draggable14').parent('li').find('span').addClass('gary');
										$('#draggable14').draggable("disable");
							        	html +='<div class="m_xline" id="remark">'+
										'<span>备注</span>'+
										'<div class="right">'+
											'<input type="text" class="text" />'+
										'</div>'+
										'<em onclick="last_remove(\''+"remark"+'\')" >移除</em>'+
									    '</div>';
									}
							        /*  */
							        if (id=="gendera") {
							        	$('#draggable1').addClass('ui-draggable-disabled');
										$('#draggable1').parent('li').find('span').removeClass('on');
										$('#draggable1').parent('li').find('span').addClass('gary');
										$('#draggable1').draggable("disable");
							        	html += '<div class="m_xline" id="gender">'+
										'<span>性别</span> '+
										'<div class="right"> '+
											'<p class="text" /></p> '+
										'</div> '+
										'<em onclick="last_remove(\''+"gender"+'\')">移除</em> '+
									    '</div> ';
									}
							        
							        if (id=="birthdaya") {
							        	$('#draggable2').addClass('ui-draggable-disabled');
										$('#draggable2').parent('li').find('span').removeClass('on');
										$('#draggable2').parent('li').find('span').addClass('gary');
										$('#draggable2').draggable("disable");
							        	html += '<div class="m_xline" id="birthday">'+
										'<span>生日</span>'+
										'<div class="right">'+
											'<p class="text" /></p>'+
										'</div>'+
										'<em onclick="last_remove(\''+"birthday"+'\')" >移除</em>'+
									    '</div>';
									}
							        if (id=="weiboa") {
							        	$('#draggable4').addClass('ui-draggable-disabled');
										$('#draggable4').parent('li').find('span').removeClass('on');
										$('#draggable4').parent('li').find('span').addClass('gary');
										$('#draggable4').draggable("disable");
							        	html += '<div class="m_xline" id="weibo">'+
										'<span>新浪微博</span>'+
										'<div class="right">'+
											'<input type="text" class="text" />'+
										'</div>'+
										'<em onclick="last_remove(\''+"weibo"+'\')">移除</em>'+
									    '</div>';
									}
							        if (id=="qqa") {
							        	$('#draggable5').addClass('ui-draggable-disabled');
										$('#draggable5').parent('li').find('span').removeClass('on');
										$('#draggable5').parent('li').find('span').addClass('gary');
										$('#draggable5').draggable("disable");
							        	html += '<div class="m_xline" id="qq">'+
										'<span>QQ</span>'+
										'<div class="right">'+
											'<input type="text" class="text" />'+
										'</div>'+
										'<em onclick="last_remove(\''+"qq"+'\')">移除</em>'+
									   '</div>';
									}
							        if (id=="wechata") {
							        	$('#draggable6').addClass('ui-draggable-disabled');
										$('#draggable6').parent('li').find('span').removeClass('on');
										$('#draggable6').parent('li').find('span').addClass('gary');
										$('#draggable6').draggable("disable");
							        	html += '<div class="m_xline" id="wechat">'+
										'<span>微信</span>'+
										'<div class="right">'+
											'<input type="text" class="text" />'+
										'</div>'+
										'<em onclick="last_remove(\''+"wechat"+'\')">移除</em>'+
									   '</div>';
									}
							        if (id=="addressa") {
				                    	$('#draggable9').addClass('ui-draggable-disabled');
										$('#draggable9').parent('li').find('span').removeClass('on');
										$('#draggable9').parent('li').find('span').addClass('gary');
										$('#draggable9').draggable("disable");
				                    	html +='<div class="m_xline" id="address">'+
										'<span>通讯地址</span>'+
										'<div class="right">'+
											'<input type="text" class="text" />'+
										'</div>'+
										'<em  onclick="last_remove(\''+"address"+'\')">移除</em>'+
									    '</div>';
									}
							        if (id=="citya") {
				                    	$('#draggable8').addClass('ui-draggable-disabled');
										$('#draggable8').parent('li').find('span').removeClass('on');
										$('#draggable8').parent('li').find('span').addClass('gary');
										$('#draggable8').draggable("disable");
				                    	html += '<div class="m_xline" id="city">'+
										'<span>城市</span>'+
										'<div class="right">'+
											'<input type="text" class="text" />'+
										'</div>'+
										'<em onclick="last_remove(\''+"city"+'\')">移除</em>'+
									   '</div>';
									}
							        if (id=="faxa") {
				                    	$('#draggable12').addClass('ui-draggable-disabled');
										$('#draggable12').parent('li').find('span').removeClass('on');
										$('#draggable12').parent('li').find('span').addClass('gary');
										$('#draggable12').draggable("disable");
				                    	html += '<div class="m_xline" id="fax">'+
				                    	 '<span>传真</span>'+
				                    	 '<div class="right">'+
				                    	 '<input type="text" class="text" />'+
				                    	 '</div>'+
				                    	 '<em onclick="last_remove(\''+"fax"+'\')">移除</em>'+
				                    	 '</div>';
				                    }
							        if (id=="taga") {
				                    	$('#draggable13').addClass('ui-draggable-disabled');
										$('#draggable13').parent('li').find('span').removeClass('on');
										$('#draggable13').parent('li').find('span').addClass('gary');
										$('#draggable13').draggable("disable");
				                    	html += '<div class="m_xline" id="tag">'+
										'<span>标签</span>'+
										'<div class="right">'+
											'<input type="text" class="text" />'+
										'</div>'+
										'<em onclick="last_remove(\''+"tag"+'\')">移除</em>'+
									    '</div>';
									}
							}
				 
				    }
				});
				

		        /* 自定义控件 */
		        
		        $('#fix_html>div>.datatime').each(function(m,data) {
		        	if (($(data).text())!=null&&($(data).text())!="") {
		        		dataid =$(data).text().trim();
		        	    
		        	    datatype = $("#TypeId"+dataid).text().trim();
		        		
		        		
		        		if (datatype=="数字") {
		        		    $('#name_数字').attr("value",dataid);
		        	        html +=	$('.m_xboxs,.always>.now>li>div>.m_xline>.right').find('div[id="数字"]').parents('.m_xline').parent('div').html();
		        		   
		        		}
		        		if (datatype=="单行文本") {
		        			 $('#name_单行文本').attr("value",dataid);
		        			html +=	$('.m_xboxs,.always>.now>li>div>.m_xline>.right').find('div[id="单行文本"]').parents('.m_xline').parent('div').html();
						}
		        		if (datatype=="多行文本") {
		        			 $('#name_多行文本').attr("value",dataid);
		        			html +=	$('.m_xboxs,.always>.now>li>div>.m_xline>.right').find('div[id="多行文本"]').parents('.m_xline').parent('div').html();
			        		
						}
		        		if (datatype=="日期") {
		        			 $('#name_日期').attr("value",dataid);
		        			html +=	$('.m_xboxs,.always>.now>li>div>.m_xline>.right').find('div[id="日期"]').parents('.m_xline').parent('div').html();
			        		
						}
		        		if (datatype=="评分") {
		        			 $('#name_评分').attr("value",dataid);
		        			html +=	$('.m_xboxs,.always>.now>li>div>.m_xline>.right').find('div[id="评分"]').parents('.m_xline').parent('div').html();
			        		
						}
		        		if (datatype=="单选") {
		        			var options = "";
		        			$(data).parents('.m_xline').find('.right').find('select').find('option').each(function(n,op){
		        				options+=$(op).text()+",";
			        		});
		        			options= options.substring(0,options.length-1);
		        			 $('#name_单选').attr("value",dataid);
		        			
		        			 $('#name_单选').parents('.right').find('textarea').text(options);
		        			
		        			html +=	$('.m_xboxs,.always>.now>li>div>.m_xline>.right').find('div[id="单选"]').parents('.m_xline').parent('div').html();
			        		
						}
		        		if (datatype=="下拉列表") {
		        			var options = "";
		        			$(data).parents('.m_xline').find('.right').find('select').find('option').each(function(n,op){
		        				options+=$(op).text()+",";
			        		});
		        			options= options.substring(0,options.length-1);
		        			 $('#name_下拉列表').attr("value",dataid);
		        			
		        			 $('#name_下拉列表').parents('.right').find('textarea').text(options);
		        			
		        			html +=	$('.m_xboxs,.always>.now>li>div>.m_xline>.right').find('div[id="下拉列表"]').parents('.m_xline').parent('div').html();
			        		
						}
		        		if (datatype=="多选") {
		        			
		        			var options = "";
		        			$(data).parents('.m_xline').find('.right').find('select').find('option').each(function(n,op){
		        				options+=$(op).text()+",";
			        		});
		        			options= options.substring(0,options.length-1);
		        			 $('#name_多选').attr("value",dataid);
		        			
		        			 $('#name_多选').parents('.right').find('textarea').text(options);
		        			 
		        			html +=	$('.m_xboxs,.always>.now>li>div>.m_xline>.right').find('div[id="多选"]').parents('.m_xline').parent('div').html();
			        		
						}
		        		if (datatype=="图片") {
		        			 $('#name_图片').attr("value",dataid);
		        			html +=	$('.m_xboxs,.always>.now>li>div>.m_xline>.right').find('div[id="图片"]').parents('.m_xline').parent('div').html();
			        		
						}
		        		if (datatype=="附件") {
		        			 $('#name_附件').attr("value",dataid);
		        			html +=	$('.m_xboxs,.always>.now>li>div>.m_xline>.right').find('div[id="附件"]').parents('.m_xline').parent('div').html();
			        		
						}
		        		if (datatype=="分割线") {
		        			html +=	$('.m_xboxs,.always>.now>li>div>.m_xline>.right').find('div[id="分割线"]').parents('.m_xline').parent('div').html();
			        		
						}
		        		
		        		
		        	}
		        });
		        
				
				
				
				 $('#droppable').html(html);
				
				
				$this.parents('.m_xconsum').removeClass('show');
				$('.m_xsubunit').addClass('show');
			
			
		});
		
		
	})
	
	
// 	$('#droppable').find('.m_xline').find('em').click(function() {
// 			$(this).parent().remove();
// 			var self = this;
// 			$('.only').each(function(index, item) {
// 				if($(item).find('.m_xline').attr('id') == $(self).parent().attr('id')) {
// 					$(item).siblings().removeClass('gary');
// 					$(item).siblings().addClass('on');
// 					$(item).draggable("enable");
// 				}
// 			})
// 		})
	function last_remove(val){
		
		
		
		
		if (val=="phone"||val=="email") {
			alert("默认必选项无法移除");
		} else {

			var val = "#"+val;
			$('#droppable').find(val).remove();
			//$(val).remove();
			
			//$('#draggable').addClass('ui-draggable-disabled');
			reflashstatus(val);
		}
		
		
	}
	
	function reflashstatus(val){
		if (val=="#name") {
			$('#draggable').parent('li').find('span').addClass('on');
			$('#draggable').parent('li').find('span').removeClass('gary');
			$('#draggable').draggable("enable");
		}
		if (val=="#phone") {
			$('#draggable3').parent('li').find('span').addClass('on');
			$('#draggable3').parent('li').find('span').removeClass('gary');
			$('#draggable3').draggable("enable");
		}
		if (val=="#email") {
			$('#draggable7').parent('li').find('span').addClass('on');
			$('#draggable7').parent('li').find('span').removeClass('gary');
			$('#draggable7').draggable("enable");
		}
		if (val=="#company") {
			$('#draggable10').parent('li').find('span').addClass('on');
			$('#draggable10').parent('li').find('span').removeClass('gary');
			$('#draggable10').draggable("enable");
		}
		if (val=="#job") {
			$('#draggable11').parent('li').find('span').addClass('on');
			$('#draggable11').parent('li').find('span').removeClass('gary');
			$('#draggable11').draggable("enable");
		}
		if (val=="#remark") {
			$('#draggable14').parent('li').find('span').addClass('on');
			$('#draggable14').parent('li').find('span').removeClass('gary');
			$('#draggable14').draggable("enable");
		}
		/*  */
		if (val=="#gender") {
			$('#draggable1').parent('li').find('span').addClass('on');
			$('#draggable1').parent('li').find('span').removeClass('gary');
			$('#draggable1').draggable("enable");
		}
		if (val=="#birthday") {
			$('#draggable2').parent('li').find('span').addClass('on');
			$('#draggable2').parent('li').find('span').removeClass('gary');
			$('#draggable2').draggable("enable");
		}
		if (val=="#weibo") {
			$('#draggable4').parent('li').find('span').addClass('on');
			$('#draggable4').parent('li').find('span').removeClass('gary');
			$('#draggable4').draggable("enable");
		}
		if (val=="#qq") {
			$('#draggable5').parent('li').find('span').addClass('on');
			$('#draggable5').parent('li').find('span').removeClass('gary');
			$('#draggable5').draggable("enable");
		}
		if (val=="#wechat") {
			$('#draggable6').parent('li').find('span').addClass('on');
			$('#draggable6').parent('li').find('span').removeClass('gary');
			$('#draggable6').draggable("enable");
		}
		if (val=="#address") {
			$('#draggable9').parent('li').find('span').addClass('on');
			$('#draggable9').parent('li').find('span').removeClass('gary');
			$('#draggable9').draggable("enable");
		}
		if (val=="#city") {
			$('#draggable8').parent('li').find('span').addClass('on');
			$('#draggable8').parent('li').find('span').removeClass('gary');
			$('#draggable8').draggable("enable");
		}
		
		if (val=="#fax") {
			$('#draggable12').parent('li').find('span').addClass('on');
			$('#draggable12').parent('li').find('span').removeClass('gary');
			$('#draggable12').draggable("enable");
		}
		if (val=="#tag") {
			$('#draggable13').parent('li').find('span').addClass('on');
			$('#draggable13').parent('li').find('span').removeClass('gary');
			$('#draggable13').draggable("enable");
		}
	}
	
	
	var ecxelstr = 1;
	var totalDayNum = 0;
	var totalConsumptionNum = 0;
	var tradingVolumeNum = 0;
	function imager(str){
		if(str == 1){
			ecxelstr = 1;
			$("#tiaoguo").attr("src","<%=path%>/images/s_icon.png");
			$("#fugai").attr("src","<%=path%>/images/s_icon_on.png");
		}else{
			ecxelstr = 2;
			$("#fugai").attr("src","<%=path%>/images/s_icon.png");
			$("#tiaoguo").attr("src","<%=path%>/images/s_icon_on.png");
		}
	}
	function import_excle_info(){
		if($("#file").val() != null && $("#file").val() != ''){
			$.ajaxFileUpload({
		        url:'<%=path%>/api/custome/importInfo?ecxelstr='+ecxelstr,//处理图片脚本
		        secureuri :false,
		        fileElementId :'file',//file控件id
		        dataType : 'json',
		        success : function (data){
		        	if(data.state == 1){
		        		alert("导入失败,导入模版不正确！");
		        	}else{
		        		var html = '<li >成功导入 <span>'+data.count+'</span>条</li>';
			        	html += '<li >表格内有第<span>　'+data.repeatPhone+'　</span>列已在系统中存在 </li>';
			        	html += '<li>表格内有<span>'+data.error+'</span>条不符合导入规范无法导入 </li>';
						$("#excelmes").html(html);
						$('.s_popups').removeClass('show');
						$('.s_popup, .m_xconsum').addClass('show');
		        	}
		       }
			}); 
		}else{
			alert("请选择导入文件！");
		}
	}
	
	function fileUpload(){
	        $("#uploadfile").click();
	}
	var startIndex = 1;// 起始页数
    var pageSize = 2;//每页行数
    var currentPage = 1;
    var pageCount = 0;
    var nameOrphone = ''; //姓名
    var activity = ''; //活动ID
    var source = ''; //来源分类
    var path = '<%=path%>';
    $(function(){
    	getSourceList();
		customerList(1,pageSize);
    	customerClassification();
    });
		$(function(){
			$(".J_xmade").click(function() {
				$.post('<%=path%>/api/userDimension/getUserDimension', {
				}, function(data) {
					data = JSON.parse(data);
					if(data.bcUserDimension != ''){
						$("#old_customer_day").val(data.bcUserDimension.oldCustomerDay);
						$("#old_customer_frequency").val(data.bcUserDimension.oldCustomerFrequency);
						$("#new_customer_day").val(data.bcUserDimension.newCustomerDay);
						$("#new_customer_frequency").val(data.bcUserDimension.newCustomerFrequency);
						$("#traveler_day").val(data.bcUserDimension.travelerDay);
						$("#traveler_frequency").val(data.bcUserDimension.travelerFrequency);
						$("#regular_day").val(data.bcUserDimension.regularDay);
						$("#regular_frequency").val(data.bcUserDimension.regularFrequency);
						$("#loyal_customer_day").val(data.bcUserDimension.loyalCustomerDay),
						$("#loyal_customer_frequency").val(data.bcUserDimension.loyalCustomerFrequency);
						$("#main_force").val(data.bcUserDimension.mainForce);
						$("#s_commonly_customer").val(data.bcUserDimension.sCommonlyCustomer);
						$("#b_commonly_customer").val(data.bcUserDimension.bCommonlyCustomer);
						$("#scattered_customer").val(data.bcUserDimension.scatteredCustomer);
						$("#lose_customer").val(data.bcUserDimension.loseCustomer);
					}
					$('.m_xdimens'). addClass('show');
				});
			});
		});
		$('.k_select').on('click',function(e){
            e.stopPropagation();
            $(this).toggleClass('selectState');
            if(!$(this).hasClass('selectState')){
              $('.k_select').removeClass('selectState');
              $(this).find('img').attr('src','<%=path%>/images/dropDown.png');
            }else{
              $(this).find('img').attr('src','<%=path%>/images/dropUp.png');
            }
          });
            $('body').on('click',function(){
                $('.k_select').removeClass('selectState');
                $('.k_select').find('img').attr('src','<%=path%>/images/dropDown.png');
            })
            $('.k_select').each(function(index,ele){
                var stateText = $(ele).find('span').text();
                $('.k_selectBox').eq(index).find('ul li').each(function(indexsLi,elesLi){
                    if($(elesLi).text()==stateText){
                        $(elesLi).addClass('on')
                    }
                });
            });
        $('.s_title li').click(function(){
            $(this).addClass('s_on').siblings().removeClass();
            var index = $(this).index();
            $('.s_container ol').removeClass('surrent').eq(index).addClass('surrent');
        });

        $('.s_all_title li').click(function(){
            $(this).addClass('s_all_on').siblings().removeClass();
            var index = $(this).index();
            $('.s_table table').removeClass('s_table_sur').eq(index).addClass('s_table_sur');
        });
        
    $(document).on("change","#select",function(e){
    	var methodName = $(this).attr("methodName");
    	getPageListTop(methodName,1);
    });
    // 自定义跳转页码
    $(document).on("keyup","#tiaozhuan",function(e){
		if(e.keyCode==13){
			var pageGo = Number($(this).val());
			if(/^[0-9]+$/.test(pageGo)){
				var pageC = Number($(this).attr("pageCount"));
				/* alert(pageGo);
				alert(pageC);
				alert((pageGo>pageC)  + "~pageGo:" + pageGo +"pageC:" + pageC); */
				var currentP = $(this).attr("currentP");//当前页
				if(pageGo<1 || pageGo>pageC){
					alert('请输入合法页数');
				}else if(pageGo != currentP){
					var methodName = $(this).attr("methodName");
					getPageListTop(methodName,pageGo);
				}
			}else{ 
				alert('请输入合法页数');
			}
		}
	});
    
    $(function (){
    	$.post('<%=path%>/api/custome/getCustomerSourceChar', {
    	}, function(data) {
    		data = JSON.parse(data);
    		charPie('c_warp1','客户来源渠道',data);
    	});
    });
    $(function (){
    	$.post('<%=path%>/api/custome/getCustomerLossCustromerChar', {
    	}, function(data) {
    		data = JSON.parse(data);
    		charPie('c_warp5','流失客户',data);
    	});
    });
    $(function (){
    	$.post('<%=path%>/api/custome/getCustomerNewChar', {
    	}, function(data) {
    		data = JSON.parse(data);
    		charPie('c_warp2','时间属性',data);
    	});
    });
    $(function (){
    	$.post('<%=path%>/api/custome/getCustomerTotalConsumptionChar', {
    	}, function(data) {
    		data = JSON.parse(data);
    		charPie('c_warp3','交易频率',data);
    	});
    });
    $(function (){
    	$.post('<%=path%>/api/custome/getCustomerTradingVolumeChar', {
    	}, function(data) {
						data = JSON.parse(data);
						charPie('c_warp4', '交易量', data);
					});
		});

		function charPie(id, text, data) {
			var myChart = echarts.init(document.getElementById(id));
			option = {
				title : {
					subtext : text,
					x : 50,
					y : 100
				},
				tooltip : {
					trigger : 'item',
					formatter : "{a} <br/>{b}: {c} ({d}%)"
				},
				legend : {
					orient : 'vertical',
					x : 'right',
					data : data.xdata
				},
				series : [ {
					name : text,
					type : 'pie',
					radius : [ '50%', '70%' ],
					center : [ '35%', '50%' ],
					avoidLabelOverlap : false,
					label : {
						normal : {
							show : false,
							position : 'center'
						},
						emphasis : {
							show : true,
							textStyle : {
								fontSize : '18',
								fontWeight : 'bold'
							}
						}
					},
					labelLine : {
						normal : {
							show : false
						}
					},
					data : data.ydata
				} ],
				color : [ '#60db4c', '#ffc006', '#03A9F4' ]
			};
			myChart.setOption(option);
		}
		$(function() {
			$("#genderadd").hide();
			$("#birthdayadd").hide();
			$("#weiboadd").hide();
			$("#qqadd").hide();
			$("#wechatadd").hide();
			$("#addressadd").hide();
			$("#cityadd").hide();
			$("#faxadd").hide();
			$("#tagadd").hide();
		})
		function add() {
			//构建控件结构字符串
			var controlhierarchystrings = "";//分割结构 {type:"",name:"" ,vals = "val&val"},
			
			var id = '';
			if ($('#droppable > div').size() == 0) {
				
			} else {
				
				$("#nameadd").hide();
				$("#phoneadd").hide();
				$("#emailadd").hide();
				$("#companyadd").hide();
				$("#jobadd").hide();
				$("#remarksadd").hide();
				$("#genderadd").hide();
				$("#birthdayadd").hide();
				$("#weiboadd").hide();
				$("#qqadd").hide();
				$("#wechatadd").hide();
				$("#addressadd").hide();
				$("#cityadd").hide();
				$("#faxadd").hide();
				$("#tagadd").hide();
				$('#droppable > div').each(function(i, data) {
					id = $(data).attr('id');
					$('#' + id + 'add').show();
					if (id!=null) {
						//记录结构
						controlhierarchystrings +=	"{type :"+"\""+"FristType"+"\""+","+"key :"+"\""+id+"\""+","+"value :"+"\""+""+"\""+"}"+","; 
						
					}
					
				});
			}
			/* zhiwen  */
			var cookie_string ="";
			var plusstring_value = "";
			   $('#droppable > .m_xline').each(function(i, data) {
				   
					if (($(data).find('.right').find('div').attr('id'))!=null&&$(data).find('.right').find('div').attr('id')!="") {
					var	type_id = $(data).find('.right').find('div').attr('id');
					cookie_string += type_id +":";
					    console.log(type_id);
					    
					    if (($(data).find('.right').find('input').val())!=null&&($(data).find('.right').find('input').val())!="") {
							var plus_name=$(data).find('.right').find('input').val();
							cookie_string += plus_name +"&";
							console.log(plus_name);
							
							if (($(data).find('.right').find('textarea').val())!=null&&($(data).find('.right').find('textarea').val())!="") {
								var plus_val=$(data).find('.right').find('textarea').val().trim();
								plusstring_value+=plus_name+":"+plus_val+"&";
								console.log("键值对为："+plusstring_value);
							} 
							
						}else {
							cookie_string +=  "&";
							alert(type_id +"不能为空,否者无法为您生成控件");
						}
					}
					
					if (($(data).find('div').attr('id'))!=null&&($(data).find('div').attr('id'))!="") {
						var only_name = $(data).find('div').attr('id');
						 cookie_string += only_name + ":"+only_name + "&";
						 console.log(only_name);
					}
					
				});
			 console.log(cookie_string);
			 //document.cookie="path=/bc;plus_data="+escape(cookie_string);//存入cookie并设置访问域
			if (cookie_string!=null&&cookie_string!="") {
				var array = new Array();//第一次分割
				var arrayob = new Array();//第二次分割
				array = cookie_string.split("&");
				console.log("循环数"+array);
				var html="";//创建html对象
				for (var i = 0; i < array.length; i++) {
					console.log("循环次数"+array[i]);
					if (array[i]!=null&&array[i]!="") {
						arrayob = array[i].split(":");
						if (arrayob[0]!=null&&arrayob[1]!=null&&arrayob[0]!=""&&arrayob[1]!=null){
							console.log("打印："+arrayob[0]);
							console.log("打印："+arrayob[1]);
							
						
							if ("数字"==arrayob[0].trim()) {
								
								console.log("空测试："+arrayob[1]);
								if ((arrayob[1].trim())!=null&&(arrayob[1].trim())!="") {
									//存入数字结构
									controlhierarchystrings +=	"{type :"+"\""+"数字"+"\""+","+"key :"+"\""+arrayob[1].trim()+"\""+","+"value :"+"\""+""+"\""+"}"+","; 
									//拼装显示控件
									html +='<div class="m_xline">'+
									'<span class="datatime">'+arrayob[1].trim()+'</span>'+
									'<div class="right">'+
									'<div id="TypeId'+arrayob[1].trim()+'" style="display:none">数字</div>'+
									'<div id="'+arrayob[1].trim()+'" style="display:none">'+arrayob[1].trim()+'</div>'+
									'<input type="number" class="text"  id = "fix_'+arrayob[1].trim()+'" name="fix_'+arrayob[1].trim()+'" />'+
									'</div>'+
									'</div>';
								}
								
							}
							 if ("单行文本"==arrayob[0].trim()) {
								 console.log("空测试："+arrayob[1]);
								 if ((arrayob[1].trim())!=null&&(arrayob[1].trim())!="") {
									 
									//存入单行文本结构
									controlhierarchystrings +=	"{type :"+"\""+"单行文本"+"\""+","+"key :"+"\""+arrayob[1].trim()+"\""+","+"value :"+"\""+""+"\""+"}"+","; 
									 
									 html +='<div class="m_xline">'+
										'<span class="datatime">'+arrayob[1].trim()+'</span>'+
										'<div class="right">'+
										'<div id="TypeId'+arrayob[1].trim()+'" style="display:none">单行文本</div>'+
										'<div id="'+arrayob[1].trim()+'" style="display:none">'+arrayob[1].trim()+'</div>'+
										'<input type="text" class="text" placeholder="请输入'+arrayob[1].trim()+'" id = "fix_'+arrayob[1].trim()+'" name="fix_'+arrayob[1].trim()+'" />'+
										'</div>'+
										'</div>';
									}
								
							}
							
							 if ("多行文本"==arrayob[0].trim()) {
								 if ((arrayob[1].trim())!=null&&(arrayob[1].trim())!="") {
									 
									//存入多行文本结构
										controlhierarchystrings +=	"{type :"+"\""+"多行文本"+"\""+","+"key :"+"\""+arrayob[1].trim()+"\""+","+"value :"+"\""+""+"\""+"}"+","; 
									 
									 html +='<div class="m_xline">'+
										'<span class="datatime">'+arrayob[1].trim()+'</span>'+
										'<div class="right">'+
										'<div id="TypeId'+arrayob[1].trim()+'" style="display:none">多行文本</div>'+
										'<div id="'+arrayob[1].trim()+'" style="display:none">'+arrayob[1].trim()+'</div>'+
										'<textarea type="text" class="text" placeholder="请输入'+arrayob[1].trim()+'" id = "fix_'+arrayob[1].trim()+'" name="fix_'+arrayob[1].trim()+'" ></textarea>'+
										'</div>'+
										'</div>';
									}
								
							}
							
							 if ("单选"==arrayob[0].trim()) {
								 if ((arrayob[1].trim())!=null&&(arrayob[1].trim())!="") {
										var fix_value=new Array();
										fix_value =plusstring_value.split("&");//分割键值对
										var select1val ="";//下拉框值html
										for (var m= 0; m < fix_value.length; m++) {
											if ((fix_value[m])!=null&&(fix_value[m])!="") {
												var key_value=  new Array();
												key_value=	fix_value[m].split(":");
												if ((key_value[0])!=null&&(key_value[0])!=""&&(key_value[1])!=null&&(key_value[1])!="") {
													if ((arrayob[1].trim())==(key_value[0].trim())) { //两个array键相等
														var final_val= new Array();
													    var seoption=key_value[1];
													    seoption= seoption.replace(eval("/"+"，"+"/g"),",");
													    
													   //存入单选结构
														controlhierarchystrings +=	"{type :"+"\""+"单选"+"\""+","+"key :"+"\""+arrayob[1].trim()+"\""+","+"value :"+"\""+seoption+"\""+"}"+","; 
													    
														final_val =seoption.split(",");
														if (final_val.length>0) {
															for (var n = 0; n < final_val.length; n++) {
																select1val+='<option value="'+final_val[n].trim()+'">'+final_val[n].trim()+'</option>';
															}
														}
													}
												}
											}
										}
										 console.log(select1val);
										 
										 html +='<div class="m_xline">'+
											'<span class="datatime">'+arrayob[1].trim()+'</span>'+
											'<div class="right">'+
											'<div id="TypeId'+arrayob[1].trim()+'" style="display:none">单选</div>'+
											'<div id="'+arrayob[1].trim()+'" style="display:none">'+arrayob[1].trim()+'</div>'+
											'<select style="height:48px;width:330px;font-size:14px;" id = "fix_'+arrayob[1].trim()+'" name="fix_'+arrayob[1].trim()+'" class="m_xselect " > '+select1val+'</select>'+
											'</div>'+
											'</div>';
										 console.log("跳出单选");	
									}
							
							}
							
							 if ("多选"==arrayob[0].trim()) {
								 if ((arrayob[1].trim())!=null&&(arrayob[1].trim())!="") {
									 console.log("进入多选");
									 var fix_value1=new Array();
										fix_value1 =plusstring_value.split("&");//分割键值对
										var select1val1 ="";//下拉框值html
										for (var m = 0; m < fix_value1.length; m++) {
											if ((fix_value1[m])!=null&&(fix_value1[m])!="") {
												var key_value1=  new Array();
												key_value1=	fix_value1[m].split(":");
												 console.log(key_value1[0].trim()+key_value1[1].trim());
												if ((key_value1[0])!=null&&(key_value1[0])!=""&&(key_value1[1])!=null&&(key_value1[1])!="") {
													if ((arrayob[1].trim())==(key_value1[0].trim())) { //两个array键相等
														var final_val1= new Array();
														 var seoption=key_value1[1];
														 seoption= seoption.replace(eval("/"+"，"+"/g"),",");
														 
														//存入多选结构
														controlhierarchystrings +=	"{type :"+"\""+"多选"+"\""+","+"key :"+"\""+arrayob[1].trim()+"\""+","+"value :"+"\""+seoption+"\""+"}"+","; 
														    
														 
														    final_val1 =seoption.split(",");
														if (final_val1.length>0) {
															for (var n = 0; n < final_val1.length; n++) {
																select1val1+='<option value="'+final_val1[n].trim()+'">'+final_val1[n].trim()+'</option>';
															}
														}
													}
												}
											}
										}
										 console.log(select1val1);
									 
									 html +='<div class="m_xline">'+
										'<span class="datatime">'+arrayob[1].trim()+'</span>'+
										'<div class="right">'+
										'<div id="TypeId'+arrayob[1].trim()+'" style="display:none">多选</div>'+
										'<div id="'+arrayob[1].trim()+'" style="display:none">'+arrayob[1].trim()+'</div>'+
										'<select style="height:48px;width:330px;font-size:14px;"  multiple="multiple"  id = "fix_'+arrayob[1].trim()+'" name="fix_'+arrayob[1].trim()+'" class="m_xselect" >'+
										select1val1+
										'</select>'+
										'</div>'+
										'</div>';
									 console.log("跳出多选");
									}
								 
								
							}
							
							 if ("下拉列表"==arrayob[0].trim()) {
								 if ((arrayob[1].trim())!=null&&(arrayob[1].trim())!="") {
									 var fix_value1=new Array();
										fix_value1 =plusstring_value.split("&");//分割键值对
										var select1val1 ="";//下拉框值html
										for (var m = 0; m < fix_value1.length; m++) {
											if ((fix_value1[m])!=null&&(fix_value1[m])!="") {
												var key_value1=  new Array();
												key_value1=	fix_value1[m].split(":");
												 console.log(key_value1[0].trim()+key_value1[1].trim());
												if ((key_value1[0])!=null&&(key_value1[0])!=""&&(key_value1[1])!=null&&(key_value1[1])!="") {
													if ((arrayob[1].trim())==(key_value1[0].trim())) { //两个array键相等
														var final_val1= new Array();
														 var seoption=key_value1[1];
														 seoption= seoption.replace(eval("/"+"，"+"/g"),",");
														 
														//存入下拉列表结构
														controlhierarchystrings +=	"{type :"+"\""+"下拉列表"+"\""+","+"key :"+"\""+arrayob[1].trim()+"\""+","+"value :"+"\""+seoption+"\""+"}"+","; 
														    
														 
														    final_val1 =seoption.split(",");
														if (final_val1.length>0) {
															for (var n = 0; n < final_val1.length; n++) {
																select1val1+='<option value="'+final_val1[n].trim()+'">'+final_val1[n].trim()+'</option>';
															}
														}
													}
												}
											}
										}
										 console.log(select1val1);
										 html +='<div class="m_xline">'+
										'<span class="datatime">'+arrayob[1].trim()+'</span>'+
										'<div class="right">'+
										'<div id="TypeId'+arrayob[1].trim()+'" style="display:none">下拉列表</div>'+
										'<div id="'+arrayob[1].trim()+'" style="display:none">'+arrayob[1].trim()+'</div>'+
										'<select style="height:48px;width:330px;font-size:14px;"  id = "fix_'+arrayob[1].trim()+'" name="fix_'+arrayob[1].trim()+'" class="m_xselect" >'+
										select1val1+
										'</select>'+
										'</div>'+
										'</div>';
									}
								
							}
							 
							
							 if ("日期"==arrayob[0].trim()) {
								 if ((arrayob[1].trim())!=null&&(arrayob[1].trim())!="") {
									 
									//存入单行文本结构
									controlhierarchystrings +=	"{type :"+"\""+"日期"+"\""+","+"key :"+"\""+arrayob[1].trim()+"\""+","+"value :"+"\""+""+"\""+"}"+","; 
										 
									 
									 html +='<div >'+
										'<span class="datatime" style="width: 20%;margin-top: 8px;float: left;text-align: right;margin-left: -19px;font-size:14px;">'+arrayob[1].trim()+'</span>'+
										'<div class="right">'+
										'<div id="TypeId'+arrayob[1].trim()+'" style="display:none">日期</div>'+
										'<div id="'+arrayob[1].trim()+'" style="display:none">'+arrayob[1].trim()+'</div>'+
										    '<div style="width: 330px;heigth:48px;margin-left:90px;">'+
										         '<div class="form-group"> '+
										               '<div class="input-group date" id="Time_'+arrayob[1].trim()+'">'+
		                                                   '<input  id = "fix_'+arrayob[1].trim()+'" name="fix_'+arrayob[1].trim()+'" type="text" class="form-control" /> '+
		                                                   '<span class="input-group-addon">'+
		                                                          '<span class="glyphicon glyphicon-calendar">'+
		                                                          '</span>'+
		                                                   '</span></div></div></div> '+
		                                '</div>'+
										'</div>';
								}
								 datadpid +="#Time_"+arrayob[1].trim()+",";
							}
							 
							
							 if ("评分"==arrayob[0].trim()) {
								 if ((arrayob[1].trim())!=null&&(arrayob[1].trim())!="") {
									 
									//存入单行文本结构
								    controlhierarchystrings +=	"{type :"+"\""+"评分"+"\""+","+"key :"+"\""+arrayob[1].trim()+"\""+","+"value :"+"\""+""+"\""+"}"+","; 
										 
									 
									 html +='<div class="m_xline">'+
										'<span class="datatime">'+arrayob[1].trim()+'</span>'+
										'<div class="right">'+
										'<div id="TypeId'+arrayob[1].trim()+'" style="display:none">评分</div>'+
										'<div id="'+arrayob[1].trim()+'" style="display:none">'+arrayob[1].trim()+'</div>'+
//	 									
										'<div class="m_xstra lsg" style="width: 150px;">'+
										'<img src="<%=path%>/images/star_2.png" '+
											'onclick="pfClick(this)" style="width: 13px;" '+
											'class="unSelect"> <img '+
											'src="<%=path%>/images/star_2.png" onclick="pfClick(this)" '+
											'style="width: 13px;" class="unSelect"> <img  '+
											'src="<%=path%>/images/star_2.png" onclick="pfClick(this)" '+
											'style="width: 13px;" class="unSelect"> <img '+
											'src="<%=path%>/images/star_2.png" onclick="pfClick(this)"  '+
											'style="width: 13px;" class="unSelect"> <img '+
											'src="<%=path%>/images/star_2.png" onclick="pfClick(this)"  '+
											'style="width: 13px;" class="unSelect">  '+
										'<dfn class="pfText">0.0分</dfn>  '+
										'<input type="text" id = "fix_'+arrayob[1].trim()+'" name="fix_'+arrayob[1].trim()+'" style="display: none;" class="pf" /> '+
								     	'</div>  '+
										
										'</div>'+
										'</div>';
									}
								 
								
							}
							 
							 if ("图片"==arrayob[0].trim()) {
								 if ((arrayob[1].trim())!=null&&(arrayob[1].trim())!="") {
									 
									//存入单行文本结构
									controlhierarchystrings +=	"{type :"+"\""+"图片"+"\""+","+"key :"+"\""+arrayob[1].trim()+"\""+","+"value :"+"\""+""+"\""+"}"+","; 
										 
									 
									 html +='<div class="m_xline">'+
										'<span class="datatime">'+arrayob[1].trim()+'</span>'+
										'<div class="right">'+
										'<div id="TypeId'+arrayob[1].trim()+'" style="display:none">图片</div>'+
										'<div id="'+arrayob[1].trim()+'" style="display:none">'+arrayob[1].trim()+'</div>'+
										'<form id="file_'+arrayob[1].trim()+'" enctype="multipart/form-data" >'+
										
										'<div style="height: 100px;width: 100px;">'+
										'<div style="width:100px;height:100px; position:relative;float:left;margin-left:4px;">'+
										'<img id="img4'+arrayob[1].trim()+'" src="<%=path%>/bm/images/img_p.png" style="width:100px;height:100px;" >'+
										'</div>'+
										'<input type="file" accept="image/gif,image/jpeg,image/x-png" id = "fix_'+arrayob[1].trim()+'" name="fix_'+arrayob[1].trim()+'" onchange="showphoto(\''+arrayob[1].trim()+'\')" '+
										' style="cursor:pointer;height:100px;width: 100px;filter: alpha(opacity = 50); -moz-opacity: 0.5; -khtml-opacity: 0.5; opacity: 0.0;'+
										 'position: absolute; z-index: 99;">'+
										'</div>'+
										
										'</form>'+
										'</div>'+
										'</div>';
									}
								 
								
							}
							 
							 if ("分割线"==arrayob[0].trim()) {
								 if ((arrayob[1].trim())!=null&&(arrayob[1].trim())!="") {
									 
									//存入单行文本结构
									controlhierarchystrings +=	"{type :"+"\""+"分割线"+"\""+","+"key :"+"\""+arrayob[1].trim()+"\""+","+"value :"+"\""+""+"\""+"}"+","; 
										 
									 
									 html +='<div class="m_xline">'+
										'<span class="datatime">'+arrayob[1].trim()+'</span>'+
										'<div class="right">'+
										'<div id="TypeId'+arrayob[1].trim()+'" style="display:none">分割线</div>'+
										'<div id="'+arrayob[1].trim()+'" style="display:none">'+arrayob[1].trim()+'</div>'+
										'<span style="display: inline-block;width: 342px;height: 20px;border-bottom: 1px dashed #ddd;margin-left: 18px;"></span>'+
										'</div>'+
										'</div>';
									}
								 
								
							}
							 
							 if ("附件"==arrayob[0].trim()) {
								 if ((arrayob[1].trim())!=null&&(arrayob[1].trim())!="") {
									 
									//存入单行文本结构
								    controlhierarchystrings +=	"{type :"+"\""+"附件"+"\""+","+"key :"+"\""+arrayob[1].trim()+"\""+","+"value :"+"\""+""+"\""+"}"+","; 
										 
									 
									 html +='<div class="m_xline">'+
										'<span class="datatime">'+arrayob[1].trim()+'</span>'+
										'<div class="right">'+
										'<div id="TypeId'+arrayob[1].trim()+'" style="display:none">附件</div>'+
										'<div id="'+arrayob[1].trim()+'" style="display:none">'+arrayob[1].trim()+'</div>'+
										'<form id="realfile_'+arrayob[1].trim()+'" enctype="multipart/form-data" >'+
										
// 										'<input type="file" id = "fix_'+arrayob[1].trim()+'" name="fix_'+arrayob[1].trim()+'" />'+
										'<div id="fileremove'+arrayob[1].trim()+'" name="have">'+
										'<input type="file" name="fix_'+arrayob[1].trim()+'" id = "fix_'+arrayob[1].trim()+'" >'+
										'</div>'+
										'</form>'+
										'</div>'+
										'</div>';
									}
								 
								 uploadpid +="#fix_"+arrayob[1].trim()+",";
							}
							 
							 
						}
					}
					
				}
				//拼接所有文本
				 $('.m_xpopups>.m_xconsum>#fix_html').html(html);
			}
		
			 //持久化控件结构   controlhierarchystrings
			  $.ajax({
       		  url: "<%=path%>/api/ComponentStructure/insert_ComponentStructure",

       		  type: "post",
       		  
       		  async: false,

       		  data:{"controlhierarchystrings":controlhierarchystrings},

       		  dataType: "json",

       		  timeout: 1000,

       		  error: function(){},

       		  success: function(data){
       			
                if (data.status=="0") {
                	console.log("持久化控件结构成功");
				}
       		  }
       		  
       		  }); 
			 
			 
			/*  */
			$('.m_xpopups , .m_xconsum').addClass('show');
			$('.m_xsubunit').removeClass('show');
		}
		    /* 定时器时间控件初始化 */
		    setInterval( function datetime() {
		    	//时间控件初始化
		    	if (datadpid!=null&&datadpid!="") {
		    		var array = new Array();
		    		array =datadpid.split(",");
		    		for (var i = 0; i < array.length; i++) {
		    			if ((array[i])!=null&&(array[i])!="") {
		    				console.log("定时器"+array[i].trim());
		    				$(array[i].trim()).datetimepicker({
		    					   minView:2,
						           //daysOfWeekDisabled: [0,6]
						        });
						} else {
                             
						}
					}
		    		
		    		 
				}
		    	
		    	//上传控件初始化
		    	if (uploadpid!=null&&uploadpid!="") {
		    		var array2 = new Array();
		    		array2 =uploadpid.split(",");
		    		for (var i = 0; i < array2.length; i++) {
		    			if ((array2[i])!=null&&(array2[i])!="") {
		    				console.log("双上传定时器"+array2[i].trim());
		    				var arrays = new Array();
		    				arrays =array2[i].split("#fix_");
		    				var spid = "#fileremove"+arrays[1];
		    				console.log("拼接移除项" +spid);
		    				if (($(spid).attr("name"))!="") {
		    					$(array2[i].trim()).filer({
								    limit: 1,
								    maxSize: 3,
								   
								    changeInput: true,
								    showThumbs: true
								});
		    				 $(".jFiler-input-caption>span").css("width","200px");
		    				 $(".jFiler-input-caption>span").css("margin-top","-16px");
		    				 
		    				 $(".jFiler-input").css("width","330px");
		    					$(spid).attr("name","");
							}
		    				
		    			
		    			} else {
                             
						}
					}
		    		
		    		 
				}
					
				
				
			       
			       
			    },4000);
		
		    
		    
		  
			  function showphoto(m){
				  var idp = "#img4"+m;
				  $(idp).attr("src","<%=path%>/bm/images/img_cp.png");
			  }
			
         
		function hideChar(){
			var html = '';
			html += '<a href="javascript:;" style="font-size: 16px; color: #03a9f4;" onclick="showChar()">显示</a>';
			$(".m_xscale").hide();
			$("#charShowOrhide").html(html)
		}
		function showChar(){
			var html = '';
			html += '<a href="javascript:;" style="font-size: 16px; color: #03a9f4;" onclick="hideChar()">隐藏</a>';
			$(".m_xscale").show();
			$("#charShowOrhide").html(html)
		}
		
	</script>
	<div style="clear: both; height: 0.1px;"></div>
</body>



<script type="text/javascript">
/*  zhiwen */
function pfClick(dom) {

	if($(dom).attr('class') == 'unSelect') {
		$(dom).removeClass('unSelect').addClass('select')
		$(dom).attr('src', '<%=path%>/images/star_1.png');
	} else {
		$(dom).removeClass('select').addClass('unSelect')
		$(dom).attr('src', '<%=path%>/images/star_2.png');
	}
	$('.pfText').text($('.select').length + '.0分');
	$('.pf').attr('value', $('.select').length);

}

/*  */
	 
	   $(function () {
	       $('#datetimepicker11').datetimepicker({
	           daysOfWeekDisabled: [0,6]
	        });
	    });
	    
	 
	  
</script>

</html>